<template>
  <yd-layout>
    <yd-navbar slot="navbar" title="选择项目" />
    <yd-cell-group>
        <yd-cell-item arrow>
            <span slot="left">所在地区：</span>
            <input slot="right" type="text" @click.stop="locVisiable = true" v-model="loc" readonly placeholder="请选择收货地址">
        </yd-cell-item>
        <yd-cityselect v-model="locVisiable" :callback="handleAddLoc" :items="district"></yd-cityselect>
    </yd-cell-group>
    <yd-cell-group>
      <yd-cell-item v-for="(item, i) in items" :key="i" arrow>
          <span slot="icon">
            <img :src="item.imgurl" alt="">
          </span>
          <span slot="left">{{item.tname}}</span>
      </yd-cell-item>
    </yd-cell-group>
  </yd-layout>
</template>

<script>
import viewMixin from "../../../mixins/page";
export default {
  mixins: [viewMixin],
  data() {
    return {
      loc:[],
      pid: null,
      cid: null,
      district: [],
      items:[],
      locVisiable:false,
    };
  },
  computed: {
    sid() {
      return this.$store.state.reservation.formData.sid;
    },
  },
  methods: {
    handleAddLoc(value){

    },
    onPageView() {
      this.loadData();
    },
    async loadLoc(){
      let res = await this.$api
        .getProCities()
        .catch(err => {});

      
      let arr = res.reduce((prevArr, currentValue)=>{
        
      }, [])
    },
    async loadData() {
      this.items = [];

      let res = await this.$api
        .searchStores({ pid: this.pid, cid: this.cid })
        .catch(err => {});

      if (res) {
        

        this.items = res;
      }
    },
  },
};
</script>
